package com.baizhi.controller;

import com.baizhi.entity.Role;
import com.baizhi.service.RoleService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @RequestMapping("selectPage")
    @ResponseBody

    public Map selectPage(Integer page,Integer limit){
        PageInfo<Role> pageInfo = roleService.selectAll(page, limit);
        Map m = new HashMap();
        m.put("code",0);
        m.put("msg","");
        m.put("count",pageInfo.getTotal());
        m.put("data",pageInfo.getList());

        return m;
    }
}
